package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.bean.User;
import com.atguigu.springcloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    //1、查询用户信息
    @GetMapping("/getUser")
    public User getUser(Integer id){
        return userService.getUser(id);
    }

    //2、查询用户信息+电影信息
    @GetMapping("/getUserAndMovie")
    public Map getUserAndMovie(Integer id){
        //Gson  转换list
        //map:user={id:11,unam:xxx} , movie={id}
        return userService.getUserAndMovie(id);
    }
}
